@extends('shared.adminBase')
@section('title','编辑用户')
@section('content')
    <section class="content-header">
        <h1>新增用户</h1>
        <ol class="breadcrumb">
            <li><a href="{{URL::action('AdminController@innerIndex')}}"><i class="fa fa-dashboard"></i> 首页</a>
            </li>
            <li><a href="{{URL::action('AdminController@getManagerList')}}">用户管理</a></li>
            <li class="active">编辑用户</li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <!-- /.box -->
                <div class="box">
                    <!-- /.box-header -->
                    <div class="box-body col-md-6">
                        <form id="form1" action="{{URL::action('AdminController@updateManager')}}" method="post">
                            <input type="hidden" name="id" value="{{$manager->manager_id}}">
                            {{csrf_field()}}
                            <div class="form-group">
                                <label>用户名</label>
                                <input type="text" name="username" class="form-control" value="{{$manager->username}}">
                                @if($errors->has('username'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('username')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>管理角色</label>
                                <select class="form-control" name="roleID">
                                    @foreach($roles as $role)
                                        @if($role->manager_role_id!=App\Framework\Config\SystemConstant::SUPER_MANAGER_ROLE_ID)
                                            @if($role->manager_role_id==$manager->manager_role_id)
                                                <option value="{{$role->manager_role_id}}"
                                                        selected="selected">{{$role->name}}</option>
                                            @else
                                                <option value="{{$role->manager_role_id}}">{{$role->name}}</option>
                                            @endif
                                        @endif
                                    @endforeach
                                </select>
                                @if($errors->has('roleID'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('roleID')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>使用状态</label>
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="status"
                                               value="{{App\Framework\Enum\ManagerStatusEnum::ENABLE}}"
                                                {{$manager->status==App\Framework\Enum\ManagerStatusEnum::ENABLE?'checked="checked"':""}}>
                                        {{App\Framework\Enum\ManagerStatusEnum::getName(App\Framework\Enum\ManagerStatusEnum::ENABLE)}}
                                    </label>
                                    <label>
                                        <input type="radio" name="status"
                                               value="{{App\Framework\Enum\ManagerStatusEnum::DISABLE}}" {{$manager->status==App\Framework\Enum\ManagerStatusEnum::DISABLE?'checked="checked"':""}}>
                                        {{App\Framework\Enum\ManagerStatusEnum::getName(App\Framework\Enum\ManagerStatusEnum::DISABLE)}}
                                    </label>
                                </div>
                                @if($errors->has('status'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('status')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>登录密码</label>
                                <input type="password" name="password" class="form-control" placeholder="请填写登录密码">
                                @if($errors->has('password'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('password')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>确认登录密码</label>
                                <input type="password" name="confirmPassword" class="form-control"
                                       placeholder="请填写一次登录密码">
                                @if($errors->has('confirmPassword'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('confirmPassword')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <label>真实姓名</label>
                                <input type="text" name="realName" class="form-control" value="{{$manager->real_name}}">
                                @if($errors->has('realName'))
                                    <span class="help-block">
                                         <strong class="text-danger">{{$errors->first('realName')}}</strong>
                                    </span>
                                @endif
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-default">提交</button>
                                <button type="button" onclick="history.back();" class="btn btn-default">返回</button>
                            </div>
                        </form>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>

@endsection

